package cn.gong.jizhang.utils;

public class StringUtils {
	public static final String CLASSNAME_STRING = "java.lang.String";
	public static final String CLASSNAME_INT = "int";
	public static final String CLASSNAME_LONG = "long";
	public static final String CLASSNAME_BYTE = "byte";
	public static final String CLASSNAME_CHAR = "char";
	public static final String CLASSNAME_DOUBLE = "double";
	public static final String CLASSNAME_FLOAT = "float";
	public static final String CLASSNAME_BOOLEAN = "boolean";
	public static final String CLASSNAME_ARRAY = "java.util.ArrayList";

	/**
	 * 判断给定字符串是否有内容。
	 * 
	 * @param str
	 * @return 如果字符串为空字符串或者null则返回false，其他情况返回true。
	 */
	public static boolean isNotBlank(String str) {
		if (str == null) {
			return false;
		} else if ("".equals(str.trim())) {
			return false;
		}
		return true;
	}

	public static boolean isNotBlank(String... strings) {
		for (String str : strings) {
			if (str == null) {
				return false;
			} else if ("".equals(str.trim())) {
				return false;
			}
		}
		return true;
	}

	public static boolean isEmpty(String string) {
		if (string == null) {
			return true;
		} else if ("".equals(string.trim())) {
			return true;
		}
		return false;
	}

	public static boolean isBaseDataType(String dataType) {
		if (CLASSNAME_BOOLEAN.equals(dataType)) {
			return true;
		} else if (CLASSNAME_INT.equals(dataType)) {
			return true;
		} else if (CLASSNAME_LONG.equals(dataType)) {
			return true;
		} else if (CLASSNAME_STRING.equals(dataType)) {
			return true;
		} else if (CLASSNAME_BYTE.equals(dataType)) {
			return true;
		} else if (CLASSNAME_CHAR.equals(dataType)) {
			return true;
		} else if (CLASSNAME_DOUBLE.equals(dataType)) {
			return true;
		} else if (CLASSNAME_FLOAT.equals(dataType)) {
			return true;
		} else {
			return false;
		}
	}
}
